package com.lgl.maker.generator;

import java.io.*;

/**
 * @author 良哥
 * @verison 1.0
 */
public class JarGenerator {

    public static void doGen(String path) throws IOException, InterruptedException {
        String windowsBuildCommand = "mvn.cmd clean package -DskipTests=true";
        String otherBuildCommand = "mvn clean package -DskipTests=true";
        String command = windowsBuildCommand;


        ProcessBuilder processBuilder = new ProcessBuilder(command.split(" "));
        processBuilder.directory(new File(path));

        Process process = processBuilder.start();

        // 读取
        InputStream inputStream = process.getInputStream();
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
        String line;
        while ((line = reader.readLine()) != null) {
            System.out.println(line);
        }
        int i = process.waitFor();
        System.out.println("退出码" + i);
    }
}
